Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup parsed AST #5464

Merged
merged 4 commits into from
Feb 2, 2024
Merged

Cleanup parsed AST #5464

merged 4 commits into from
Feb 2, 2024

Conversation

tritao
Copy link
Contributor

@tritao tritao commented Jan 12, 2024

Description

This cleans up the parsed AST by doing the following:

Remove unused ReturnStatement.

Refactor Declaration::ImplicitReturnExpression as Expression::ImplicitReturn

During the work on debugging some issues around this refactoring, an issue with the way that implicit/explicit return type-checking is currently realized was found, which is reported in #5518.

Currently this was "worked-around" by special casing the type-checking of implicit returns, just like it is currently done, but we should look into unifying this behaviour in a later PR (I've been looking into it, but all hell breaks loose after an initial try).

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@tritao tritao added code quality compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler: parser Everything to do with the parser labels Jan 12, 2024
@tritao tritao self-assigned this Jan 12, 2024
@tritao tritao force-pushed the cleanup-parsed-ast branch from b635722 to 40554c3 Compare January 22, 2024 10:28
@tritao tritao force-pushed the cleanup-parsed-ast branch 6 times, most recently from f65cfa6 to ad10adb Compare January 31, 2024 23:33
@tritao tritao force-pushed the cleanup-parsed-ast branch from ad10adb to 16ffc5a Compare February 1, 2024 00:00
@tritao tritao force-pushed the cleanup-parsed-ast branch from 16ffc5a to 970534d Compare February 1, 2024 00:33
@tritao tritao marked this pull request as ready for review February 1, 2024 08:19
@tritao tritao requested review from a team February 1, 2024 08:19
@tritao tritao enabled auto-merge (squash) February 1, 2024 09:44
IGI-111
IGI-111 previously approved these changes Feb 1, 2024
@IGI-111 IGI-111 requested a review from a team February 1, 2024 12:45
xunilrj
xunilrj previously approved these changes Feb 1, 2024
@tritao tritao dismissed stale reviews from xunilrj and IGI-111 via eda3c33 February 1, 2024 17:08
@tritao tritao requested review from xunilrj and IGI-111 February 1, 2024 17:08
@tritao tritao requested a review from a team February 1, 2024 17:08
@tritao tritao force-pushed the cleanup-parsed-ast branch from eda3c33 to 6eadefb Compare February 1, 2024 17:09
Copy link
Member

@ironcev ironcev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to have this cleanup! And also that it revealed the type checking issue.

Just a small detail, there are three clone() operations in code, of expressions and nodes that are not necessary and are simple to remove.

@tritao
Copy link
Contributor Author

tritao commented Feb 2, 2024

Good catch, cleaned up those unnecessary clones.

@tritao tritao merged commit 71e9ea9 into FuelLabs:master Feb 2, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler: parser Everything to do with the parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants